package com.team7.order.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.team7.order.dao.VideoDao;
import com.team7.order.entity.Video;
import com.team7.order.service.VideoService;
import com.team7.order.utils.CommonResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class VideoServiceImpl extends ServiceImpl<VideoDao, Video> implements VideoService {
    @Resource
    private VideoDao videoDao;
    //    根据课程id查询所有的章节视频
    @Override
    public CommonResult queryAllVideoByCourseId(String id) {
        QueryWrapper<Video> videoWrapper = new QueryWrapper<>();
        videoWrapper.eq("course_id",id);
        videoWrapper.eq("is_free",true);
        List<Video> videos = videoDao.selectList(videoWrapper);
        System.out.println(videos);
        return new CommonResult(2000,"查询成功",videos);
//        List<Video> videos = videoDao.queryAllImgByID(id);
//        return new CommonResult(2000,"查询成功",videos);
    }
}
